package com.hotelManagerSystem.service.impl;

import com.hotelManagerSystem.model.Staff;
import com.hotelManagerSystem.mapper.StaffMapper;
import com.hotelManagerSystem.model.StaffDepartment;
import com.hotelManagerSystem.service.IStaffService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  职工服务实现类
 * </p>
 *
 * @author longyajr
 * @since 2021-12-22
 */
@Service
public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {

    @Autowired
    private StaffMapper staffMapper;



    @Override
    public List<Staff> queryStaffList() {
        return staffMapper.selectList(null);
    }
    //另建立Model
    @Override
    public List<StaffDepartment> queryStaffDepartmentList() {
        return staffMapper.queryStaffDepartmentList();
    }

    @Override
    public Staff queryByUsername(String username) {
        return staffMapper.queryByUsername(username);
    }

    @Override
    public List<Staff> queryStaffByCleanOrderState() {
        return staffMapper.queryStaffByCleanOrderState();
    }




    //二:根据职工的id把该职工添加进黑名单
    @Override
    public int addStaffById(int staffId) {
        return staffMapper.addStaffById(staffId);
    }
    //三:黑名单功能:根据职工的id把该该职工从黑名单中移除(即黑名单的删除)
    @Override
    public int deleteStaffById(Integer staffId) {
        return staffMapper.deleteStaffById(staffId);
    }
    //四:查询所有黑名单职工
    @Override
    public List<Staff> selectBlackStaffList() {
        return staffMapper.selectBlackStaffList();
    }
    //五:查询所有白名单职工
    @Override
    public List<Staff> selectWhiteStaffList() {
        return staffMapper.selectWhiteStaffList();
    }
    //六:根据用户名来查询职工
    @Override
    public List<Staff> selectStaffByUsername(String username) {
        return staffMapper.selectStaffByUsername(username);
    }

    //插入一条员工的记录
    @Override
    public boolean insertStaff(Staff staff) {
        return staffMapper.insertStaff(staff);
    }

    @Override
    public List<StaffDepartment> queryStaffByUsername(String username) {
        return staffMapper.queryStaffByUsername(username);
    }

    @Override
    public StaffDepartment selectOneStaff(Integer staffId) {
        return staffMapper.selectOneStaff(staffId);
    }

    @Override
    public boolean updateStaff(Staff staff) {
        return staffMapper.updateStaff(staff);
    }

}
